
    #need asserts for player owning both territories
    #needs assert to check that a player is not attack themselves
    #needs assert for enough armies to move
    #assert territory is null or owned by player

def neighbor(t1,t2): #checks to see if a territory is a neighbor to another
    return t1 in routes[t2]

#comment out the code if you want to but it doesn't get in the way of anything
def handle_fortifying(terr, button):
    #Handle the fortification phase.
    global armiesfrom, armiesto
    if terr.player != currentplayer:
        return
    if armiesfrom is not None and armiesto is not None and \
       (selected != armiesfrom or terr != armiesto):
        riskgui.set_status("You can only fortify from one place to one space per turn.")
        return
    if not selected.neighboring(terr):
        return
    moving = min(selected.armies - 1, (button == 3) and 5 or 1)
    if moving:
        selected.armies -= moving
        terr.armies += moving
        armiesfrom = selected
        armiesto = terr
        riskgui.drawterritory(armiesfrom, 1)
        riskgui.drawterritory(armiesto, 0)